import React, { Component } from 'react'
import Luo from 'iscroll-luo';
import {bindActionCreators} from "redux"
import {connect} from "react-redux"
import * as action from "../action"
class App1 extends Component {
    constructor(props) {
        super(props);
        this.state = {
            data: [1, 2, 3], // 初始数据
        };
      }
     componentDidMount(){
        this.props.getLIST1()
     }
      /** 下拉刷新 **/
      onDown() {
        this.props.getLIST1("xiala")
      }
     
      /** 上拉加载更多 **/
      onUp() {
        this.props.getLIST1("shangla")
      }
     render () {
         return (
             <div className='app1'>
                <Luo
  				id='id'
  				onDown={() => this.onDown()}
            	onUp={() => this.onUp()}
  			>
  				{
                    this.props.arr1 &&  this.props.arr1.length ? this.props.arr1.map((item,index)=>{
                        return <div key={index}>
                            <h4>{item.name}</h4>
                            <img src={item.img} alt=""></img>
                        </div>
                    }):""
                }				
  			</Luo>

             </div>
         )
     }
      
}
const mapStateToProps = (state) => {
    return {
        ...state.AppReducer
    }
}

const mapDispatchToProps = (dispatch)=>bindActionCreators(action,dispatch)
export default connect(mapStateToProps,mapDispatchToProps)(App1)